#!/bin/bash

set -x

# --  Set environment variables

export XDG_SESSION_DESKTOP=KDE
export XDG_CURRENT_DESKTOP=KDE
export QT_AUTO_SCREEN_SCALE_FACTOR=0

# --  Start Cask

cask

# --  To logout we will check if cask is running and if not kill the user session.

USERNAME=`echo $USER`

if pgrep -f cask >/dev/null

then
  echo "Cask is running"
else
  pkill -KILL -u $USERNAME
fi
